package 强化训练;

import java.util.Scanner;

public class 二进制中连续的1的长度 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        int maxlen = 0;
        while(num != 0){
            if(num % 2 == 1){
                sb.append("1");
            }else{
                maxlen = maxlen > sb.length() ? maxlen : sb.length();
                sb = new StringBuilder();
            }
           maxlen = maxlen > sb.length() ? maxlen : sb.length();
            num = num / 2;
        }
        System.out.println(maxlen);
    }
}

